from .basePage import BasePage
from selenium.webdriver.common.by import By
class Register(BasePage):
    username_input =(By.NAME, 'username')
    email_input = (By.NAME, 'email')
    pwd_input = (By.NAME, 'pwd')
    confirmPwd_input = (By.NAME, 'confirmPwd')
    captcha_input = (By.NAME, 'captcha')
    btn = (By.CLASS_NAME, 'btn')

    def __init__(self,driver,hostname):
        super().__init__(driver)
        self.url =f"http://{hostname}/jpress/user/register".format(hostname=hostname)
    def goto_register_page(self):
        self.goto_page(self.url)
    def input_username(self,username):
        self.input_text(self.username_input,username)
    def input_email(self,email):
        self.input_text(self.email_input, email)
    def input_pwd(self,pwd):
        self.input_text(self.pwd_input,pwd)
    def input_confirmPwd(self,confirmPwd):
        self.input_text(self.confirmPwd_input,confirmPwd)
    def input_captcha(self,captcha):
        self.input_text(self.captcha_input,captcha)
    def submit(self):
        self.click(self.btn)







